<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>C preprocessor</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/C_preprocessor"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-C_preprocessor rootpage-C_preprocessor skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">C preprocessor</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p class="mw-empty-elt">
</p>
<style data-mw-deduplicate="TemplateStyles:r1305433154">
/* start https://en.wikipedia.org/ */
.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1248332772">
/* start https://en.wikipedia.org/ */
.mw-parser-output .multiple-issues-text{width:95%;margin:0.2em 0}.mw-parser-output .multiple-issues-text>.mw-collapsible-content{margin-top:0.3em}.mw-parser-output .compact-ambox .ambox{border:none;border-collapse:collapse;background-color:transparent;margin:0 0 0 1.6em!important;padding:0!important;width:auto;display:block}body.mediawiki .mw-parser-output .compact-ambox .ambox.mbox-small-left{font-size:100%;width:auto;margin:0}.mw-parser-output .compact-ambox .ambox .mbox-text{padding:0!important;margin:0!important}.mw-parser-output .compact-ambox .ambox .mbox-text-span{display:list-item;line-height:1.5em;list-style-type:disc}body.skin-minerva .mw-parser-output .multiple-issues-text>.mw-collapsible-toggle,.mw-parser-output .compact-ambox .ambox .mbox-image,.mw-parser-output .compact-ambox .ambox .mbox-imageright,.mw-parser-output .compact-ambox .ambox .mbox-empty-cell,.mw-parser-output .compact-ambox .hide-when-compact{display:none}
/* end https://en.wikipedia.org/ */
</style>
<p>The <b>C preprocessor</b> (<b>CPP</b>) is a <a href="Text_file" title="Text file">text file</a> <a href="Preprocessor" title="Preprocessor">processor</a> that is used with <a href="C_(programming_language)" title="C (programming language)">C</a>, <a href="C%2B%2B" title="C++">C++</a> and other <a href="Programming_tool" title="Programming tool">programming tools</a>. The preprocessor provides for file inclusion (often <a href="Header_files" class="mw-redirect" title="Header files">header files</a>), <a href="Macro_(computer_science)" title="Macro (computer science)">macro</a> expansion, <a href="Conditional_compilation" title="Conditional compilation">conditional compilation</a>, and line control. Although named in association with C and used with C, the preprocessor capabilities are not inherently tied to the C language. It can and is used to process other kinds of files.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p><p>C, C++, and <a href="Objective-C" title="Objective-C">Objective-C</a> compilers provide a preprocessor capability, as it is required by the definition of each language. Some compilers provide extensions and deviations from the target language standard. Some provide options to control standards compliance. For instance, the GNU C preprocessor can be made more standards compliant by supplying certain command-line flags.<sup id="cite_ref-gnu-cpp-overview_2-0" class="reference"><a href="#cite_note-gnu-cpp-overview-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p><p>The <a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a> programming language also allows for directives, even though they cannot be used for creating macros, and is generally more intended for features such as conditional compilation.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> C# seldom requires the use of the directives, for example code inclusion does not require a preprocessor at all (as C# relies on a package/namespace system like Java, no code needs to be "included").
</p><p>The <a href="Haskell" title="Haskell">Haskell</a> programming language also allows the usage of the C preprocessor, which is invoked by writing <code class="mw-highlight mw-highlight-lang-haskell mw-content-ltr" dir="ltr"><span class="cm">{-# LANGUAGE CPP #-}</span></code> at the top of the file. The accepted preprocessor directives align with those in standard C/C++.
</p><p>Features of the preprocessor are encoded in <a href="Source_code" title="Source code">source code</a> as <a href="Directive_(programming)" title="Directive (programming)">directives</a> that start with <code>#</code>.
</p><p>Although C++ source files are often named with a <code>.cpp</code> extension, that is an abbreviation for "C plus plus"; not C preprocessor.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Preprocessor_directives">Preprocessor directives</h2></div>
<p>The following languages have the following accepted directives.
</p>
<div class="mw-heading mw-heading3"><h3 id="C/C++">C/C++</h3></div>
<p>The following tokens are recognised by the preprocessor in the context of preprocessor directives.
</p>
<style data-mw-deduplicate="TemplateStyles:r1184024115">
/* start https://en.wikipedia.org/ */
.mw-parser-output .div-col{margin-top:0.3em;column-width:30em}.mw-parser-output .div-col-small{font-size:90%}.mw-parser-output .div-col-rules{column-rule:1px solid #aaa}.mw-parser-output .div-col dl,.mw-parser-output .div-col ol,.mw-parser-output .div-col ul{margin-top:0}.mw-parser-output .div-col li,.mw-parser-output .div-col dd{page-break-inside:avoid;break-inside:avoid-column}
/* end https://en.wikipedia.org/ */
</style><div class="div-col" style="column-width: 15em;">
<ul><li><code>#if</code></li>
<li><code>#elif</code></li>
<li><code>#else</code></li>
<li><code>#endif</code></li>
<li><code>#ifdef</code></li>
<li><code>#ifndef</code></li>
<li><code>#elifdef</code></li>
<li><code>#elifndef</code></li>
<li><code>#define</code></li>
<li><code>#undef</code></li>
<li><code>#include</code></li>
<li><code>#embed</code></li>
<li><code>#line</code></li>
<li><code>#error</code></li>
<li><code>#warning</code></li>
<li><code>#pragma</code></li>
<li><code>defined</code> (follows a conditional directive; not actually a directive, but rather an operator)</li>
<li><code>__has_include</code> (operator)</li>
<li><code>__has_cpp_attribute</code> (operator, C++ only)</li>
<li><code>__has_c_attribute</code> (operator, C only)</li>
<li><code>__has_embed</code> (operator)</li></ul>
</div>
<p>Until <a href="C%2B%2B26" title="C++26">C++26</a>, the C++ keywords <code>import</code>, <code>export</code>, and <code>module</code> were partially handled by the preprocessor as well.
</p><p>Haskell also accepts C preprocessor directives.
</p>
<div class="mw-heading mw-heading3"><h3 id="C#">C#</h3></div>
<p>Although C# does not have a separate preprocessor, these directives are processed as if there were one.
</p>
<div class="div-col" style="column-width: 15em;">
<ul><li><code>#nullable</code></li>
<li><code>#if</code></li>
<li><code>#elif</code></li>
<li><code>#else</code></li>
<li><code>#endif</code></li>
<li><code>#define</code></li>
<li><code>#undef</code></li>
<li><code>#region</code></li>
<li><code>#endregion</code></li>
<li><code>#error</code></li>
<li><code>#warning</code></li>
<li><code>#line</code></li>
<li><code>#pragma</code></li></ul>
</div>
<p>C# does not use a preprocessor to handle these directives, and thus they are not handled or removed by a preprocessor, but rather directly read by the C# compiler as a feature of the language.
</p>
<div class="mw-heading mw-heading3"><h3 id="Objective-C">Objective-C</h3></div>
<p>The following tokens are recognised by the preprocessor in the context of preprocessor directives.
</p>
<div class="div-col" style="column-width: 15em;">
<ul><li><code>#if</code></li>
<li><code>#elif</code></li>
<li><code>#else</code></li>
<li><code>#endif</code></li>
<li><code>#ifdef</code></li>
<li><code>#ifndef</code></li>
<li><code>#define</code></li>
<li><code>#undef</code></li>
<li><code>#include</code></li>
<li><code>#import</code></li>
<li><code>#error</code></li>
<li><code>#pragma</code></li>
<li><code>defined</code></li></ul>
</div>
<div class="mw-heading mw-heading2"><h2 id="History">History</h2></div>
<p>The preprocessor was introduced to C around 1973 at the urging of Alan Snyder and also in recognition of the usefulness of the file inclusion mechanisms available in <a href="BCPL" title="BCPL">BCPL</a> and <a href="PL/I" title="PL/I">PL/I</a>. The first version offered file inclusion via <code>#include</code> and parameterless string replacement macros via <code>#define</code>. It was extended shortly after, firstly by <a href="Mike_Lesk" title="Mike Lesk">Mike Lesk</a> and then by John Reiser, to add arguments to macros and to support <a href="Conditional_compilation" title="Conditional compilation">conditional compilation</a>.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p><p>The C preprocessor was part of a long macro-language tradition at Bell Labs, which was started by Douglas Eastwood and <a href="Douglas_McIlroy" title="Douglas McIlroy">Douglas McIlroy</a> in 1959.<sup id="cite_ref-BellSAP_5-0" class="reference"><a href="#cite_note-BellSAP-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Phases">Phases</h2></div>
<p>Preprocessing is defined by the first four (of eight) <i>phases of translation</i> specified in the C Standard.
</p>
<ol><li>Trigraph replacement: The preprocessor replaces <a href="C_trigraph" class="mw-redirect" title="C trigraph">trigraph sequences</a> with the characters they represent. This phase was removed in <a href="C23_(C_standard_revision)" title="C23 (C standard revision)">C23</a> following the steps of <a href="C%2B%2B17" title="C++17">C++17</a>.</li>
<li>Line splicing: Physical source lines that are continued with <a href="Escape_character" title="Escape character">escaped</a> <a href="Newline" title="Newline">newline</a> sequences are <i>spliced</i> to form logical lines.</li>
<li>Tokenization: The preprocessor breaks the result into <i>preprocessing tokens</i> and <a href="Whitespace_character" title="Whitespace character">whitespace</a>. It replaces comments with whitespace.</li>
<li>Macro expansion and directive handling: Preprocessing directive lines, including file inclusion and conditional compilation, are executed. The preprocessor simultaneously expands macros and, since the 1999 version of the C standard, handles <code>_Pragma</code> operators.</li></ol>
<div class="mw-heading mw-heading2"><h2 id="Features">Features</h2></div>
<div class="mw-heading mw-heading3"><h3 id="File_inclusion">File inclusion</h3></div>
<p>There are two directives in the C preprocessor for including contents of files:
</p>
<ul><li><code>#include</code>, used for directly including the contents of a file in-place (typically containing code of some kind)</li>
<li><code>#embed</code>, used for directly including or embedding the contents of a binary resource in-place</li></ul>
<div class="mw-heading mw-heading4"><h4 id="Code_inclusion">Code inclusion</h4></div>
<p>To include the content of one file into another, the preprocessor replaces a line that starts with <code>#include</code> with the content of the file specified after the directive. The inclusion may be logical in the sense that the resulting content may not be stored on disk and certainly is not overwritten to the source file. The file being included need not contain any sort of code, as this directive will copy the contents of whatever file is included in-place, but the most typical use of <code>#include</code> is to include a header file (or in some rarer cases, a source file).
</p><p>In the following example code, the preprocessor replaces the line <code>#include <stdio.h></code> with the content of the standard library header file named '<style data-mw-deduplicate="TemplateStyles:r886049734">
/* start https://en.wikipedia.org/ */
.mw-parser-output .monospaced{font-family:monospace,monospace}
/* end https://en.wikipedia.org/ */
</style><span class="monospaced">stdio.h</span>' in which the <a href="Function_(computer_programming)" title="Function (computer programming)">function</a> <code>printf()</code> and other symbols are declared.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#include</span><span class="w"> </span><span class="cpf"><stdio.h></span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"Hello, World!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
<p>In this case, the file name is enclosed in angle brackets to denote that it is a system file. For a file in the <a href="Codebase" title="Codebase">codebase</a> being <a href="Software_build" title="Software build">built</a>, double-quotes are used instead. The preprocessor may use a different search algorithm to find the file based on this distinction.
</p><p>For C, a header file is usually named with a <code>.h</code> extension. In C++, the convention for file extension varies with common extensions <code>.h</code> and <code>.hpp</code>. But the preprocessor includes a file regardless of the extension. In fact, sometimes code includes <code>.c</code> or <code>.cpp</code> files.
</p><p>To prevent including the same file multiple times which often leads to a compiler error, a header file typically contains an <a href="Include_guard" title="Include guard"><span class="monospaced">#include</span> guard</a> or if supported by the preprocessor <a href="Pragma_once" title="Pragma once"><span class="monospaced">#pragma once</span></a> to prevent multiple inclusion.
</p>
<div class="mw-heading mw-heading4"><h4 id="Binary_resource_inclusion">Binary resource inclusion</h4></div>
<p><a href="C23_(C_standard_revision)" title="C23 (C standard revision)">C23</a> and <a href="C%2B%2B26" title="C++26">C++26</a> introduce the <code>#embed</code> directive for <b>binary resource inclusion</b> which allows including the content of a binary file into a source even though it's not valid C code.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup>
This allows binary resources (like images) to be included into a program without requiring processing by external tools like <code>xxd -i</code> and without the use of <a href="String_literal" title="String literal">string literals</a> which have a length limit on <a href="MSVC" class="mw-redirect" title="MSVC">MSVC</a>. Similarly to <code>xxd -i</code> the directive is replaced by a comma separated list of integers corresponding to the data of the specified resource. More precisely, if an array of type <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">unsigned char</code> is initialized using an <code>#embed</code> directive, the result is the same as-if the resource was written to the array using <code><a href="Fread" class="mw-redirect" title="Fread">fread</a></code> (unless a parameter changes the embed element width to something other than <code><a href="Limits.h" class="mw-redirect" title="Limits.h">CHAR_BIT</a></code>). Apart from the convenience, <code>#embed</code> is also easier for compilers to handle, since they are allowed to skip expanding the directive to its full form due to the <a href="As-if_rule" title="As-if rule">as-if rule</a>.
</p><p>The file to embed is specified the same as for <code>#include</code> – either with <a href="Angle_brackets" class="mw-redirect" title="Angle brackets">brackets</a> or double quotes. The directive also allows certain parameters to be passed to it to customize its behavior. The C standard defines some parameters and implementations may define additional. The <code>limit</code> parameter is used to limit the width of the included data. It is mostly intended to be used with "infinite" files like <a href="Urandom" class="mw-redirect" title="Urandom">urandom</a>. The <code>prefix</code> and <code>suffix</code> parameters allow for specifying a prefix and suffix to the embedded data. Finally, the <code>if_empty</code> parameter replaces the entire directive if the resource is empty. All standard parameters can be surrounded by double underscores, just like standard attributes on C23, for example <code>__prefix__</code> is interchangeable with <code>prefix</code> . Implementation-defined parameters use a form similar to <a href="C%2B%2B11#Attributes" title="C++11">attribute</a> syntax (e.g., <code>vendor::attr</code>) but without the square brackets. While all standard parameters require an argument to be passed to them (e.g., limit requires a width), this is generally optional and even the set of parentheses can be omitted if an argument is not required, which might be the case for some implementation-defined parameters.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="k">const</span><span class="w"> </span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">icon_display_data</span><span class="p">[]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="cp">#embed "art.png"</span>
<span class="p">};</span>
<span class="cm">/* specify any type which can be initialized form integer constant expressions will do */</span>
<span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">reset_blob</span><span class="p">[]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="cp">#embed "data.bin"</span>
<span class="p">};</span>
<span class="cm">/* attributes work just as well */</span>
<span class="k">const</span><span class="w"> </span><span class="kt">signed</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">aligned_data_str</span><span class="p">[]</span><span class="w"> </span><span class="n">__attribute__</span><span class="w"> </span><span class="p">((</span><span class="n">aligned</span><span class="w"> </span><span class="p">(</span><span class="mi">8</span><span class="p">)))</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="cp">#embed "attributes.xml"</span>
<span class="p">};</span>
<span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">return</span>
<span class="cp">#embed </dev/urandom> limit(1)</span>
<span class="w"> </span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Conditional_compilation">Conditional compilation</h3></div>
<p><a href="Conditional_compilation" title="Conditional compilation">Conditional compilation</a> is supported via the <a href="If-else" class="mw-redirect" title="If-else">if-else</a> core directives <code>#if</code>, <code>#else</code>, <code>#elif</code>, and <code>#endif</code> and with contraction directives <code>#ifdef</code> and <code>#ifndef</code> which stand for <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">#if defined(...)</code> and <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">#if !defined(...)</code>, respectively. In the following example code, the <code>printf()</code> call is only included for compilation if <code>VERBOSE</code> is defined.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#ifdef VERBOSE</span>
<span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"trace message"</span><span class="p">);</span>
<span class="cp">#endif</span>
</pre></div>
<p>The following demonstrates more complex logic:
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#if !(defined __LP64__ || defined __LLP64__) || defined _WIN32 && !defined _WIN64</span>
<span class="w"> </span><span class="c1">// code for a 32-bit system</span>
<span class="cp">#else</span>
<span class="w"> </span><span class="c1">// code for a 64-bit system</span>
<span class="cp">#endif</span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Macro_string_replacement">Macro string replacement</h3></div>
<dl><dt>Object-like</dt></dl>
<p>A macro specifies how to replace text in the source code with other text. An <i>object-like</i> macro defines a token that the preprocessor replaces with other text. It does not include parameter syntax and therefore cannot support parameterization. The following macro definition associates the text "1 / 12" with the token "VALUE":
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#define VALUE 1 / 12</span>
</pre></div>
<dl><dt>Function-like</dt></dl>
<p>A <i>function-like</i> macro supports parameters; although the parameter list can be empty. The following macro definition associates the expression "(A + B)" with the token "ADD" that has parameters "A" and "B".
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#define ADD(A, B) (A + B)</span>
</pre></div>
<p>A function-like macro declaration cannot have whitespace between the token and the first, opening parenthesis. If whitespace is present, the macro is interpreted as object-like with everything starting at the first parenthesis included in the replacement text.
</p>
<dl><dt>Expansion</dt></dl>
<p>The preprocessor replaces each token of the code that matches a macro token with the associated replacement text in what is known as <i>macro expansion</i>. Note that text of string literals and comments is not parsed as tokens and is therefore ignored for macro expansion. For a function-like macro, the macro parameters are also replaced with the values specified in the macro reference. For example, <code>ADD(VALUE, 2)</code> expands to <code>1 / 12 + 2</code>.
</p>
<dl><dt>Variadic</dt></dl>
<p>A <a href="Variadic_macro" class="mw-redirect" title="Variadic macro">variadic macro</a> (introduced with <a href="C99" title="C99">C99</a>) accepts a varying number of arguments which is particularly useful when wrapping functions that accept a variable number of parameters, such as <code><a href="Printf" title="Printf">printf</a></code>.
</p>
<dl><dt>Order of expansion</dt></dl>
<p><i>Function-like</i> macro expansion occurs in the following stages:
</p>
<ol><li>Stringification operations are replaced with the textual representation of their argument's replacement list (without performing expansion).</li>
<li>Parameters are replaced with their replacement list (without performing expansion).</li>
<li>Concatenation operations are replaced with the concatenated result of the two operands (without expanding the resulting token).</li>
<li>Tokens originating from parameters are expanded.</li>
<li>The resulting tokens are expanded as normal.</li></ol>
<p>This may produce surprising results:
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#define HE HI</span>
<span class="cp">#define LLO _THERE</span>
<span class="cp">#define HELLO "HI THERE"</span>
<span class="cp">#define CAT(a,b) a##b</span>
<span class="cp">#define XCAT(a,b) CAT(a,b)</span>
<span class="cp">#define CALL(fn) fn(HE,LLO)</span>
<span class="n">CAT</span><span class="p">(</span><span class="n">HE</span><span class="p">,</span><span class="w"> </span><span class="n">LLO</span><span class="p">)</span><span class="w"> </span><span class="c1">// "HI THERE", because concatenation occurs before normal expansion</span>
<span class="n">XCAT</span><span class="p">(</span><span class="n">HE</span><span class="p">,</span><span class="w"> </span><span class="n">LLO</span><span class="p">)</span><span class="w"> </span><span class="c1">// HI_THERE, because the tokens originating from parameters ("HE" and "LLO") are expanded first</span>
<span class="n">CALL</span><span class="p">(</span><span class="n">CAT</span><span class="p">)</span><span class="w"> </span><span class="c1">// "HI THERE", because this evaluates to CAT(a,b)</span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Undefine_macro">Undefine macro</h3></div>
<p>A macro definition can be removed from the preprocessor context via <code>#undef</code> such that subsequent reference to the macro token will not expand. For example:
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#undef VALUE</span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Predefined_macros">Predefined macros</h3></div>
<p>The preprocessor provides some macro definitions automatically. The C standard specifies that <code>__FILE__</code> expands to the name of the file being processed and <code>__LINE__</code> expands to the number of the line that contains the directive. The following macro, <code>DEBUGPRINT</code>, formats and prints a message with the file name and line number.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#define DEBUGPRINT(_fmt, ...) printf("[%s:%d]: " _fmt, __FILE__, __LINE__, __VA_ARGS__)</span>
</pre></div>
<p>For the example code below that is on line 30 of file <code>util.c</code> and for count 123, the output is: <code>[util.c:30]: count=123</code>.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="n">DEBUGPRINT</span><span class="p">(</span><span class="s">"count=%d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span><span class="w"> </span><span class="n">count</span><span class="p">);</span>
</pre></div>
<p>The first <a href="ANSI_C#C89_and_C90" title="ANSI C">C Standard</a> specified that <code>__STDC__</code> expand to "1" if the implementation conforms to the ISO standard and "0" otherwise and that <code>__STDC_VERSION__</code> expand to a numeric literal specifying the version of the standard supported by the implementation. Standard C++ compilers support the <code>__cplusplus</code> macro. Compilers running in non-standard mode must not set these macros or must define others to signal the differences.
</p><p>Other standard macros include <code>__DATE__</code>, the current date, and <code>__TIME__</code>, the current time.
</p><p>The second edition of the C Standard, <a href="C99" title="C99">C99</a>, added support for <code>__func__</code>, which contains the name of the function definition within which it is contained, but because the preprocessor is <a href="https://en.wiktionary.org/wiki/agnostic" class="extiw external" title="wikt:agnostic">agnostic</a> to the grammar of C, this must be done in the compiler itself using a variable local to the function.
</p><p>One little-known usage pattern of the C preprocessor is known as <a href="X_Macro" class="mw-redirect" title="X Macro">X-Macros</a>.<sup id="cite_ref-X_macros_8-0" class="reference"><a href="#cite_note-X_macros-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> An X-Macro is a <a href="Header_file" class="mw-redirect" title="Header file">header file</a>. Commonly, these use the extension <code>.def</code> instead of the traditional <code>.h</code> . This file contains a list of similar macro calls, which can be referred to as "component macros." The include file is then referenced repeatedly.
</p><p>Many compilers define additional, non-standard macros. A common reference for these macros is the <a rel="nofollow" class="external text" href="https://predef.sourceforge.net/">Pre-defined C/C++ Compiler Macros project</a>, which lists "various pre-defined compiler macros that can be used to identify standards, compilers, operating systems, hardware architectures, and even basic run-time libraries at compile-time."
</p><p>Most compilers targeting <a href="Microsoft_Windows" title="Microsoft Windows">Microsoft Windows</a> implicitly define <code>_WIN32</code>.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup> This allows code, including preprocessor commands, to compile only when targeting Windows systems. A few compilers define <code>WIN32</code> instead. For such compilers that do not implicitly define the <code>_WIN32</code> macro, it can be specified on the compiler's command line, using <code>-D_WIN32</code>.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#ifdef __unix__ </span><span class="cm">/* __unix__ is usually defined by compilers targeting Unix systems */</span>
<span class="cp">#</span><span class="w"> </span><span class="cp">include</span><span class="w"> </span><span class="cpf"><unistd.h></span>
<span class="cp">#elif defined _WIN32 </span><span class="cm">/* _WIN32 is usually defined by compilers targeting 32 or 64 bit Windows systems */</span>
<span class="cp">#</span><span class="w"> </span><span class="cp">include</span><span class="w"> </span><span class="cpf"><windows.h></span>
<span class="cp">#endif</span>
</pre></div>
<p>The example code tests if a macro <code>__unix__</code> is defined. If it is, the file <code><unistd.h></code> is then included. Otherwise, it tests if a macro <code>_WIN32</code> is defined instead. If it is, the file <code><windows.h></code> is then included.
</p>
<div class="mw-heading mw-heading3"><h3 id="Line_control">Line control</h3></div>
<p>The values of the predefined macros <code>__FILE__</code> and <code>__LINE__</code> can be set for a subsequent line via the <code>#line</code> directive. In the code below, <code>__LINE__</code> expands to 314 and <code>__FILE__</code> to "pi.c".
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#line 314 "pi.c"</span>
<span class="n">printf</span><span class="p">(</span><span class="s">"line=%d file=%s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span><span class="w"> </span><span class="n">__LINE__</span><span class="p">,</span><span class="w"> </span><span class="n">__FILE__</span><span class="p">);</span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Operators">Operators</h3></div>
<p>The preprocessor is capable of interpreting operators and evaluating very basic expressions, such as integer constants, arithmetic operators, comparison operators, logical operators, bitwise operations, the <code>defined</code> operator, and the <code>#</code> stringificafion operator. This allows the preprocessor to make evaluations such as:
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#if X == 10 </span><span class="c1">// if X equals 10, the preprocessor sees #if 10 == 10</span>
</pre></div>
<div class="mw-heading mw-heading4"><h4 id="Defined_operator">Defined operator</h4></div>
<p>While the <b>defined operator</b>, denoted by <code>defined</code> is not a directive in its own right, if it is read within a directive, it is interpreted by the preprocessor and determines whether a macro has been defined.
</p><p>The following are both accepted ways of invoking the <code>defined</code> operator.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#if defined(MY_MACRO)</span>
<span class="cp">#if defined MY_MACRO</span>
</pre></div>
<div class="mw-heading mw-heading4"><h4 id="Token_stringification_operator">Token stringification operator</h4></div>
<p>The <b>stringification operator</b> (a.k.a. stringizing operator), denoted by <code>#</code> converts a token into a <a href="String_literal" title="String literal">string literal</a>, escaping any quotes or backslashes as needed. For definition:
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#define str(s) #s</span>
</pre></div>
<p><code>str(\n)</code> expands to <code>"\n"</code> and <code>str(p = "foo\n";)</code> expands to <code>"p = \"foo\\n\";"</code>.
</p><p>If stringification of the expansion of a macro argument is desired, two levels of macros must be used. For definition:
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#define xstr(s) str(s)</span>
<span class="cp">#define str(s) #s</span>
<span class="cp">#define foo 4</span>
</pre></div>
<p><code>str(foo)</code> expands to "foo" and <code>xstr(foo)</code> expands to "4".
</p><p>A macro argument cannot be combined with additional text and then stringified. However, a series of adjacent string literals and stringified arguments, also string literals, are concatenated by the C compiler.
</p>
<div class="mw-heading mw-heading4"><h4 id="Token_concatenation">Token concatenation</h4></div>
<p>The <b>token pasting operator</b>, denoted by <code>##</code>, concatenates two tokens into one. For definition:
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#define DECLARE_STRUCT_TYPE(name) typedef struct name##_s name##_t</span>
</pre></div>
<p><code>DECLARE_STRUCT_TYPE(g_object)</code> expands to <code>typedef struct g_object_s g_object_t</code>.
</p>
<div class="mw-heading mw-heading3"><h3 id="Abort">Abort</h3></div>
<p>Processing can be aborted via the <code>#error</code> directive. For example:
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#if RUBY_VERSION == 190</span>
<span class="cp">#error Ruby version 1.9.0 is not supported</span>
<span class="cp">#endif</span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Warning">Warning</h3></div>
<p>As of <a href="C23_(C_standard_revision)" title="C23 (C standard revision)">C23</a><sup id="cite_ref-N3096_12-0" class="reference"><a href="#cite_note-N3096-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup> and <a href="C%2B%2B23" title="C++23">C++23</a>,<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup> a warning directive, <code>#warning</code>, to print a message without aborting is provided. Some typical uses are to warn about the use of <a href="Deprecated" class="mw-redirect" title="Deprecated">deprecated</a> functionality. For example:
</p><p>Prior to C23 and C++23, this directive existed in many compilers as a non-standard feature, such as the C compilers by GNU, Intel, Microsoft and IBM. Because it was non-standard, the warning macro had varying forms:
</p>
<div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span class="c1">// GNU, Intel and IBM</span>
<span class="cp">#warning "Do not use ABC, which is deprecated. Use XYZ instead."</span>
<span class="c1">// Microsoft</span>
<span class="cp">#pragma message("Do not use ABC, which is deprecated. Use XYZ instead.")</span>
</pre></div>
<div class="mw-heading mw-heading2"><h2 id="Non-standard_features">Non-standard features</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Pragma">Pragma</h3></div>
<p>The <code>#pragma</code> directive is defined by standard languages, but with little or no requirements for syntax after its name so that compilers are free to define subsequent syntax and associated behavior. For instance, a pragma is often used to allow suppression of error messages, manage heap and stack debugging and so on.
</p><p>C99 introduced a few standard pragmas, taking the form <code>#pragma STDC ...</code>, which are used to control the floating-point implementation. The alternative, macro-like form <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">_Pragma(...)</code> was also added.
</p><p>One of the most popular uses of the <code>#pragma</code> directive is <a href="Pragma_once" title="Pragma once"><span class="monospaced">#pragma once</span></a>, which behaves the same way an <a href="Include_guard" title="Include guard"><span class="monospaced">#include</span> guard</a> would, condensed into a single directive placed at the top of the file. Despite being non-standard, it is supported by most compilers.
</p>
<div class="mw-heading mw-heading3"><h3 id="Trigraphs">Trigraphs</h3></div>
<p>Many implementations do not support trigraphs or do not replace them by default.
</p>
<div class="mw-heading mw-heading3"><h3 id="Assertion">Assertion</h3></div>
<p>Some <a href="Unix" title="Unix">Unix</a> preprocessors provided an <a href="Assertion_(computing)" class="mw-redirect" title="Assertion (computing)">assertion</a> feature – which has little similarity to standard library assertions.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Include_next">Include next</h3></div>
<p>GCC provides <code>#include_next</code> for chaining headers of the same name.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Import">Import</h3></div>
<p>Unlike C and C++, Objective-C includes an <code>#import</code> directive that is like <code>#include</code> but results in a file being included only once – eliminating the need for include guards and <a href="Pragma_once" title="Pragma once"><code>#pragma once</code></a>.
</p>
<div class="mw-highlight mw-highlight-lang-objective-c mw-content-ltr" dir="ltr"><pre><span class="cp">#import <Foundation/Foundation.h></span>
<span class="cp">#import "MyClass.h"</span>
</pre></div>
<p>In <a href="Microsoft_Visual_C%2B%2B" title="Microsoft Visual C++">Microsoft Visual C++</a> (MSVC), there also exists an <code>#import</code> preprocessor directive, used to import type libraries.<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup> It is a nonstandard directive.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="cp">#import "C:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "ADOEOF")</span>
</pre></div>
<p>The Objective-C directive should not be confused with the C++ keyword <code>import</code>, which is used to import C++ <a href="Modules_(C%2B%2B)" title="Modules (C++)">modules</a> (since <a href="C%2B%2B20" title="C++20">C++20</a>), and is not a preprocessor directive.
</p>
<div class="mw-heading mw-heading3"><h3 id="Nullable">Nullable</h3></div>
<p>The <code>#nullable</code> directive in C# is used to enable and disable nullable reference types. To enable them, use <code>#nullable enable</code>, and <code>#nullable disable</code> to disable them.
</p>
<div class="mw-highlight mw-highlight-lang-csharp mw-content-ltr" dir="ltr"><pre><span class="err">#</span><span class="n">nullable</span><span class="w"> </span><span class="n">enable</span>
<span class="kt">string?</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">null</span><span class="p">;</span><span class="w"> </span><span class="c1">// OK</span>
<span class="kt">string</span><span class="w"> </span><span class="n">fullName</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">null</span><span class="p">;</span><span class="w"> </span><span class="c1">// Warning: possible null assignment</span>
<span class="err">#</span><span class="n">nullable</span><span class="w"> </span><span class="n">disable</span>
<span class="kt">string</span><span class="w"> </span><span class="n">test</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">null</span><span class="p">;</span><span class="w"> </span><span class="c1">// No warning</span>
</pre></div>
<p>This directive does not exist in C/C++.
</p>
<div class="mw-heading mw-heading3"><h3 id="Region">Region</h3></div>
<p>The <code>#region</code> and <code>#endregion</code> directives in C# are used to expand/collapse sections of code in IDEs, and has no effect on actual compilation of the program. It is primarily used for code organisation and readability.
</p>
<div class="mw-highlight mw-highlight-lang-csharp mw-content-ltr" dir="ltr"><pre><span class="cp">#region Helper methods</span>
<span class="k">void</span><span class="w"> </span><span class="nf">Log</span><span class="p">(</span><span class="kt">string</span><span class="w"> </span><span class="n">message</span><span class="p">)</span>
<span class="p">{</span>
<span class="w"> </span><span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">message</span><span class="p">);</span>
<span class="p">}</span>
<span class="cp">#endregion</span>
</pre></div>
<p>While this directive does not exist in C/C++, MSVC and Visual Studio instead have <code>#pragma region</code> and <code>#pragma endregion</code>.<sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span class="cite-bracket">[</span>17<span class="cite-bracket">]</span></a></sup> Thus the equivalent C++ code would be:
</p>
<div class="mw-highlight mw-highlight-lang-c++ mw-content-ltr" dir="ltr"><pre><span class="cp">#pragma region Helper methods</span>
<span class="kt">void</span><span class="w"> </span><span class="nf">log</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string_view</span><span class="w"> </span><span class="n">message</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">println</span><span class="p">(</span><span class="n">message</span><span class="p">);</span>
<span class="p">}</span>
<span class="cp">#pragma endregion</span>
</pre></div>
<div class="mw-heading mw-heading2"><h2 id="Other_uses">Other uses</h2></div>
<p>Traditionally, the C preprocessor was a separate <a href="Development_tool" class="mw-redirect" title="Development tool">development tool</a> from the compiler with which it is usually used. In that case, it can be used separately from the compiler. Notable examples include use with the (deprecated) <a href="Imake" title="Imake">imake</a> system and for preprocessing <a href="Fortran" title="Fortran">Fortran</a>. However, use as a <a href="General_purpose_preprocessor" class="mw-redirect" title="General purpose preprocessor">general purpose preprocessor</a> is limited since the source code language must be relatively C-like for the preprocessor to parse it.<sup id="cite_ref-gnu-cpp-overview_2-1" class="reference"><a href="#cite_note-gnu-cpp-overview-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p><p>The <a href="GNU_Fortran" title="GNU Fortran">GNU Fortran</a> compiler runs "traditional mode" CPP before compiling Fortran code if certain file extensions are used.<sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span class="cite-bracket">[</span>18<span class="cite-bracket">]</span></a></sup> Intel offers a Fortran preprocessor, fpp, for use with the <a href="Intel_Fortran_Compiler" title="Intel Fortran Compiler">ifort</a> compiler, which has similar capabilities.<sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span class="cite-bracket">[</span>19<span class="cite-bracket">]</span></a></sup>
</p><p>CPP also works acceptably with most <a href="Assembly_language" title="Assembly language">assembly languages</a> and Algol-like languages. This requires that the language syntax not conflict with CPP syntax, which means no lines starting with <code>#</code> and that double quotes, which CPP interprets as <a href="String_literal" title="String literal">string literals</a> and thus ignores, don't have syntactical meaning other than that. The "traditional mode" (acting like a pre-ISO C preprocessor) is generally more permissive and better suited for such use.<sup id="cite_ref-20" class="reference"><a href="#cite_note-20"><span class="cite-bracket">[</span>20<span class="cite-bracket">]</span></a></sup>
</p><p>Some modern compilers such as the <a href="GNU_C_Compiler" class="mw-redirect" title="GNU C Compiler">GNU C Compiler</a> provide preprocessing as a feature of the compiler; not as a separate tool.
</p>
<div class="mw-heading mw-heading2"><h2 id="Limitations">Limitations</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Text_substitution_limitations">Text substitution limitations</h3></div>
<p>Text substitution has a relatively high risk of causing a <a href="Software_bug" title="Software bug">software bug</a> as compared to other programming constructs.<sup id="cite_ref-21" class="reference"><a href="#cite_note-21"><span class="cite-bracket">[</span>21<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-processor_22-0" class="reference"><a href="#cite_note-processor-22"><span class="cite-bracket">[</span>22<span class="cite-bracket">]</span></a></sup>
</p>
<dl><dt>Hidden multiple evaluation</dt></dl>
<p>Consider the common definition of a <i>max</i> macro:
</p>
<div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span class="cp">#define max(a,b) (((a) > (b)) ? (a) : (b))</span>
</pre></div>
<p>The expressions represented by <i>a</i> and <i>b</i> are both evaluated two times due to macro expansion, but this aspect is not obvious in the code where the macro is referenced. If the actual expressions have constant value, then multiple evaluation is not problematic from a logic standpoint even though it can affect runtime performance. But if an expression evaluates to a different value on subsequent evaluation, then the result may be unexpected. For example, given <code>int i = 1; j = 2;</code>, the result of <code>max(i,j)</code> is 2. If <i>a</i> and <i>b</i> were only evaluated once, the result of <code>max(i++,j++)</code> would be the same, but with double evaluation the result is 3.
</p>
<dl><dt>Hidden order of operation</dt></dl>
<p>Failure to bracket arguments can lead to unexpected results. For example, a macro to double a value might be written as:
</p>
<div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span class="cp">#define double(x) 2 * x</span>
</pre></div>
<p>But <code>double(1 + 2)</code> expands to <code>2 * 1 + 2</code> which due to order of operations, evaluates to 4 when the expected is 6. To mitigate this problem, a macro should bracket all expressions and substitution variables:
</p>
<div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span class="cp">#define double(x) (2 * (x))</span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Not_general_purpose">Not general purpose</h3></div>
<p>The C preprocessor is not <a href="Turing_completeness" title="Turing completeness">Turing-complete</a>, but comes close. Recursive computations can be specified, but with a fixed upper bound on the amount of recursion performed.<sup id="cite_ref-23" class="reference"><a href="#cite_note-23"><span class="cite-bracket">[</span>23<span class="cite-bracket">]</span></a></sup> However, the C preprocessor is not designed to be, nor does it perform well as, a general-purpose programming language. As the C preprocessor does not have features of some other preprocessors, such as recursive macros, selective expansion according to quoting, and string evaluation in conditionals, it is very limited in comparison to a more general macro processor such as <a href="M4_(computer_language)" title="M4 (computer language)">m4</a>.
</p>
<div class="mw-heading mw-heading2"><h2 id="Phase_out">Phase out</h2></div>
<p>Due to its limitations and lack of type safety (as the preprocessor is completely oblivious to C/C++ grammar, performing only text substitutions), C and C++ language features have been added over the years to minimize the value and need for the preprocessor.
</p>
<dl><dt>Constant</dt></dl>
<p>For a long time, a preprocessor macro provided the preferred way to define a constant value. An alternative has always been to define a <code>const</code> variable, but that results in consuming runtime memory. A newer language construct (since C++11 and C23), <code>constexpr</code> allows for declaring a compile-time constant value that need not consume runtime memory.<sup id="cite_ref-24" class="reference"><a href="#cite_note-24"><span class="cite-bracket">[</span>24<span class="cite-bracket">]</span></a></sup>
</p>
<dl><dt>Inline function</dt></dl>
<p>For a long time, a function-like macro was the only way to define function-like behavior that did not incur runtime function call overhead. Via the <code>inline</code> keyword and <a href="Optimizing_compiler" title="Optimizing compiler">optimizing compilers</a> that inline automatically, some functions can be invoked without call overhead.
</p>
<dl><dt>Import</dt></dl>
<p>The include directive limits code structure since it only allows including the content of one file into another. More modern languages support a <a href="Modular_programming" title="Modular programming">module</a> concept that has public symbols that other modules import – instead of including file content. Many contend that resulting code has reduced boilerplate and is easier to maintain since there is only one file for a module; not both a header and a body. <a href="C%2B%2B20" title="C++20">C++20</a> adds <a href="Modules_(C%2B%2B)" title="Modules (C++)">modules</a>, and an <code>import</code> statement that is not handled via preprocessing.<sup id="cite_ref-25" class="reference"><a href="#cite_note-25"><span class="cite-bracket">[</span>25<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-26" class="reference"><a href="#cite_note-26"><span class="cite-bracket">[</span>26<span class="cite-bracket">]</span></a></sup> Modules in C++ compile faster and link faster than traditional headers,<sup id="cite_ref-27" class="reference"><a href="#cite_note-27"><span class="cite-bracket">[</span>27<span class="cite-bracket">]</span></a></sup> and eliminate the necessity of <a href="Include_guard" title="Include guard"><span class="monospaced">#include</span> guards</a> or <a href="Pragma_once" title="Pragma once"><span class="monospaced">#pragma once</span></a>. Until C++26, <code>import</code>, <code>export</code>, and <code>module</code> keywords were partially handled by the preprocessor.
</p><p>For code bases that cannot migrate to modules immediately, C++ also offers "header units" as a feature, which allows header files to be imported in the same way a module would. Unlike modules, header units may emit macros, offering minimal breakage between migration. Header units are designed to be a transitional solution before totally migrating to modules.<sup id="cite_ref-28" class="reference"><a href="#cite_note-28"><span class="cite-bracket">[</span>28<span class="cite-bracket">]</span></a></sup> For instance, one may write <code class="mw-highlight mw-highlight-lang-c++ mw-content-ltr" dir="ltr"><span class="k">import</span><span class="w"> </span><span class="o"><</span><span class="n">string</span><span class="o">></span><span class="p">;</span></code> instead of <code class="mw-highlight mw-highlight-lang-c++ mw-content-ltr" dir="ltr"><span class="cp">#include</span><span class="w"> </span><span class="cpf"><string></span></code>, or <code class="mw-highlight mw-highlight-lang-c++ mw-content-ltr" dir="ltr"><span class="k">import</span><span class="w"> </span><span class="s">"MyHeader.hpp"</span><span class="p">;</span></code> instead of <code class="mw-highlight mw-highlight-lang-c++ mw-content-ltr" dir="ltr"><span class="cp">#include</span><span class="w"> </span><span class="cpf">"MyHeader.hpp"</span></code>. Paradoxically, most build systems, such as <a href="CMake" title="CMake">CMake</a>, do not currently support this feature.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="C_syntax" title="C syntax">C syntax</a></li>
<li><a href="C%2B%2B_syntax" title="C++ syntax">C++ syntax</a></li>
<li><a href="C_Sharp_syntax" title="C Sharp syntax">C# syntax</a></li>
<li><a href="Make_(software)" title="Make (software)">Make</a></li>
<li><a href="M4_(computer_language)" title="M4 (computer language)">m4 (computer language)</a></li>
<li><a href="PL/I_preprocessor" title="PL/I preprocessor">PL/I preprocessor</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap mw-references-columns"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://gist.github.com/djedr/7d21eac05ce2bbbca29b29d532a1fbe4">General-purpose text preprocessing with the C preprocessor. Featuring JavaScript</a></span>
</li>
<li id="cite_note-gnu-cpp-overview-2"><span class="mw-cite-backlink">^ <a href="#cite_ref-gnu-cpp-overview_2-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-gnu-cpp-overview_2-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text">
<style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/cpp/Overview.html">"The C Preprocessor: Overview"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">17 July</span> 2016</span>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives">"C# preprocessor directives"</a>. Microsoft. 14 January 2022.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><a href="#CITEREFRitchie1993">Ritchie (1993)</a></span>
</li>
<li id="cite_note-BellSAP-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-BellSAP_5-0">^</a></b></span> <span class="reference-text"><cite class="citation encyclopaedia cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20231014100551/https://hopl.info/showlanguage.prx?exp=5635">"Bell SAP – SAP with conditional and recursive macros"</a>. <i>HOPL: Online Historical Encyclopaedia of Programming Languages</i>. Archived from <a rel="nofollow" class="external text" href="https://hopl.info/showlanguage.prx?exp=5635">the original</a> on 14 October 2023<span class="reference-accessdate">. Retrieved <span class="nowrap">4 October</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm">"WG14-N3017 : #embed – a scannable, tooling-friendly binary resource inclusion mechanism"</a>. <i>open-std.org</i>. 27 June 2022. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20221224045304/https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm">Archived</a> from the original on 24 December 2022.</cite></span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p1967r14.html">"#embed - a scannable, tooling-friendly binary resource inclusion mechanism"</a>. <i>open-std.org</i>.</cite></span>
</li>
<li id="cite_note-X_macros-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-X_macros_8-0">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://liw.iki.fi/liw/texts/cpp-trick.html">Wirzenius, Lars. C "Preprocessor Trick For Implementing Similar Data Types". Retrieved January 9, 2011</a></span>
</li>
<li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><cite id="CITEREFMeyers2001" class="citation journal cs1">Meyers, Randy (May 2001). <a rel="nofollow" class="external text" href="http://www.ddj.com/cpp/184401387">"The New C: X Macros"</a>. <i>Dr. Dobb's Journal</i><span class="reference-accessdate">. Retrieved <span class="nowrap">1 May</span> 2008</span>.</cite></span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><cite id="CITEREFBeal2004" class="citation journal cs1">Beal, Stephan (August 2004). <a rel="nofollow" class="external text" href="http://wanderinghorse.net/computing/papers/#supermacros">"Supermacros"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">27 October</span> 2008</span>.</cite> <span class="cs1-visible-error citation-comment"><code class="cs1-code">{{cite journal}}</code>: </span><span class="cs1-visible-error citation-comment">Cite journal requires <code class="cs1-code">|journal=</code> (help)</span></span>
</li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/library/b0084kay.aspx">List of predefined ANSI C and Microsoft C++ implementation macros.</a></span>
</li>
<li id="cite_note-N3096-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-N3096_12-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf">"WG14-N3096 : Draft for ISO/IEC 9899:2023"</a> <span class="cs1-format">(PDF)</span>. <i>open-std.org</i>. 1 April 2023. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20230402172459/https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf">Archived</a> <span class="cs1-format">(PDF)</span> from the original on 2 April 2023.</cite></span>
</li>
<li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://open-std.org/JTC1/SC22/WG21/docs/papers/2023/n4944.pdf">"Working Draft, Standard for Programming Language C++"</a> <span class="cs1-format">(PDF)</span>. 22 March 2023.</cite></span>
</li>
<li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/cpp/Obsolete-Features.html">GCC Obsolete features</a></span>
</li>
<li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html">"Wrapper Headers (The C Preprocessor)"</a>.</cite></span>
</li>
<li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://learn.microsoft.com/en-us/cpp/preprocessor/hash-import-directive-cpp">"#import directive (C++)"</a>.</cite></span>
</li>
<li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://learn.microsoft.com/en-us/cpp/preprocessor/region-endregion">"region and endregion pragma"</a>.</cite></span>
</li>
<li id="cite_note-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-18">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/gfortran/Preprocessing-and-conditional-compilation.html">"1.3 Preprocessing and conditional compilation"</a>. GNU Project.</cite></span>
</li>
<li id="cite_note-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-19">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://software.intel.com/en-us/node/524749">"Using the fpp Preprocessor"</a>. Intel<span class="reference-accessdate">. Retrieved <span class="nowrap">14 October</span> 2015</span>.</cite></span>
</li>
<li id="cite_note-20"><span class="mw-cite-backlink"><b><a href="#cite_ref-20">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/cpp/Overview.html">"Overview (The C Preprocessor)"</a>. <i>gcc.gnu.org</i>. <q>Having said that, you can often get away with using cpp on things which are not C. Other Algol-ish programming languages are often safe (Ada, etc.) So is assembly, with caution. -traditional-cpp mode preserves more white space, and is otherwise more permissive. Many of the problems can be avoided by writing C or C++ style comments instead of native language comments, and keeping macros simple.</q></cite></span>
</li>
<li id="cite_note-21"><span class="mw-cite-backlink"><b><a href="#cite_ref-21">^</a></b></span> <span class="reference-text"><cite id="CITEREFGerard_J._Holzmann" class="citation web cs1">Gerard J. Holzmann. <a rel="nofollow" class="external text" href="http://spinroot.com/gerard/pdf/P10.pdf">"The power of ten - Rules for developing safety critical code"</a> <span class="cs1-format">(PDF)</span>. <i>safety of macros</i>. p. 4.</cite></span>
</li>
<li id="cite_note-processor-22"><span class="mw-cite-backlink"><b><a href="#cite_ref-processor_22-0">^</a></b></span> <span class="reference-text">
<cite id="CITEREFMichael_D._ErnstGreg_J._BadrosDavid_Notkin2002" class="citation journal cs1">Michael D. Ernst; Greg J. Badros; David Notkin (December 2002). <span class="id-lock-subscription" title="Paid subscription required"><a rel="nofollow" class="external text" href="http://dl.acm.org/citation.cfm?id=631305">"An empirical analysis of c preprocessor use"</a></span>. <i>IEEE Transactions on Software Engineering</i>. <b>28</b> (12): <span class="nowrap">1146–</span>1170. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2FTSE.2002.1158288">10.1109/TSE.2002.1158288</a>.</cite></span>
</li>
<li id="cite_note-23"><span class="mw-cite-backlink"><b><a href="#cite_ref-23">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://stackoverflow.com/a/10526117">"Is the C99 preprocessor Turing complete?"</a>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20160424212425/https://stackoverflow.com/questions/3136686/is-the-c99-preprocessor-turing-complete/10526117">Archived</a> from the original on 24 April 2016.</cite></span>
</li>
<li id="cite_note-24"><span class="mw-cite-backlink"><b><a href="#cite_ref-24">^</a></b></span> <span class="reference-text"><cite id="CITEREFGabriel_Dos_ReisBjarne_Stroustrup2010" class="citation web cs1">Gabriel Dos Reis; Bjarne Stroustrup (22 March 2010). <a rel="nofollow" class="external text" href="http://www.stroustrup.com/sac10-constexpr.pdf">"General Constant Expressions for System Programming Languages, Proceedings SAC '10"</a> <span class="cs1-format">(PDF)</span>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20180613125602/http://www.stroustrup.com/sac10-constexpr.pdf">Archived</a> <span class="cs1-format">(PDF)</span> from the original on 13 June 2018<span class="reference-accessdate">. Retrieved <span class="nowrap">8 July</span> 2024</span>.</cite></span>
</li>
<li id="cite_note-25"><span class="mw-cite-backlink"><b><a href="#cite_ref-25">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://isocpp.org/files/papers/n4720.pdf">"N4720: Working Draft, Extensions to C++ for Modules"</a> <span class="cs1-format">(PDF)</span>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20190430095053/https://isocpp.org/files/papers/n4720.pdf">Archived</a> <span class="cs1-format">(PDF)</span> from the original on 30 April 2019.</cite></span>
</li>
<li id="cite_note-26"><span class="mw-cite-backlink"><b><a href="#cite_ref-26">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1857r1.html">"P1857R1 – Modules Dependency Discovery"</a>.</cite></span>
</li>
<li id="cite_note-27"><span class="mw-cite-backlink"><b><a href="#cite_ref-27">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://learn.microsoft.com/en-us/cpp/build/compare-inclusion-methods?view=msvc-170">"Overview of modules in C++"</a>. Microsoft. 12 February 2022.</cite></span>
</li>
<li id="cite_note-28"><span class="mw-cite-backlink"><b><a href="#cite_ref-28">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://learn.microsoft.com/en-us/cpp/build/walkthrough-header-units?view=msvc-170">"Walkthrough: Build and import header units in Microsoft Visual C++"</a>. Microsoft. 12 April 2022.</cite></span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="Sources">Sources</h2></div>
<ul><li><cite id="CITEREFRitchie1993" class="citation journal cs1"><a href="Dennis_Ritchie" title="Dennis Ritchie">Ritchie, Dennis M.</a> (March 1993). <a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F155360.155580">"The Development of the C Language"</a>. <i>ACM SIGPLAN Notices</i>. <b>28</b> (3). ACM: <span class="nowrap">201–</span>208. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F155360.155580">10.1145/155360.155580</a></span>.</cite></li>
<li><cite class="citation conference cs1">Ritchie, Dennis M. (1993). <span class="id-lock-subscription" title="Paid subscription required"><a rel="nofollow" class="external text" href="http://www.bell-labs.com/usr/dmr/www/chist.html">"The Development of the C Language"</a></span>. <i>The Second ACM SIGPLAN Conference on History of Programming Languages (HOPL-II)</i>. <a href="Association_for_Computing_Machinery" title="Association for Computing Machinery">ACM</a>. pp. <span class="nowrap">201–</span>208. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F154766.155580">10.1145/154766.155580</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>0-89791-570-4</bdi><span class="reference-accessdate">. Retrieved <span class="nowrap">4 November</span> 2014</span>.</cite></li></ul>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1290876196">
/* start https://en.wikipedia.org/ */
.mw-parser-output .side-box{margin:4px 0;box-sizing:border-box;border:1px solid #aaa;font-size:88%;line-height:1.25em;background-color:var(--background-color-interactive-subtle,#f8f9fa);display:flow-root}.mw-parser-output .infobox .side-box{font-size:100%}.mw-parser-output .side-box-abovebelow,.mw-parser-output .side-box-text{padding:0.25em 0.9em}.mw-parser-output .side-box-image{padding:2px 0 2px 0.9em;text-align:center}.mw-parser-output .side-box-imageright{padding:2px 0.9em 2px 0;text-align:center}@media(min-width:500px){.mw-parser-output .side-box-flex{display:flex;align-items:center}.mw-parser-output .side-box-text{flex:1;min-width:0}}@media(min-width:720px){.mw-parser-output .side-box{width:238px}.mw-parser-output .side-box-right{clear:right;float:right;margin-left:1em}.mw-parser-output .side-box-left{margin-right:1em}}
/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1237033735">
/* start https://en.wikipedia.org/ */
@media print{body.ns-0 .mw-parser-output .sistersitebox{display:none!important}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}
/* end https://en.wikipedia.org/ */
</style><div class="side-box side-box-right sistersitebox"><style data-mw-deduplicate="TemplateStyles:r1126788409">
/* start https://en.wikipedia.org/ */
.mw-parser-output .plainlist ol,.mw-parser-output .plainlist ul{line-height:inherit;list-style:none;margin:0;padding:0}.mw-parser-output .plainlist ol li,.mw-parser-output .plainlist ul li{margin-bottom:0}
/* end https://en.wikipedia.org/ */
</style>
<div class="side-box-flex">
<div class="side-box-image"><span class="noviewer" typeof="mw:File"></span></div>
<div class="side-box-text plainlist">Wikibooks has a book on the topic of: <i><b><a href="https://en.wikibooks.org/wiki/C_Programming/Preprocessor" class="extiw external" title="wikibooks:C Programming/Preprocessor">C Programming/Preprocessor</a></b></i></div></div>
</div>
<ul><li><a rel="nofollow" class="external text" href="http://www.open-std.org/JTC1/SC22/WG14/www/standards">ISO/IEC 9899</a>. The latest publicly available version of the C11 standard is <a rel="nofollow" class="external text" href="https://www.open-std.org/JTC1/SC22/WG14/www/docs/n1570.pdf">the final draft</a>.</li>
<li><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/cpp/index.html">GNU CPP online manual</a></li>
<li><a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/library/y4skk93w(VS.80).aspx">Visual Studio .NET preprocessor reference</a></li>
<li><a rel="nofollow" class="external text" href="https://predef.sourceforge.net/">Pre-defined C/C++ Compiler Macros project</a>: lists "various pre-defined compiler macros that can be used to identify standards, compilers, operating systems, hardware architectures, and even basic run-time libraries at compile-time"</li></ul>
<div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}
/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1236075235">
/* start https://en.wikipedia.org/ */
.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}
/* end https://en.wikipedia.org/ */
</style></div><div role="navigation" class="navbox" aria-labelledby="C_programming_language527" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><style data-mw-deduplicate="TemplateStyles:r1239400231">
/* start https://en.wikipedia.org/ */
.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><div id="C_programming_language527" style="font-size:114%;margin:0 4em"><a href="C_(programming_language)" title="C (programming language)">C programming language</a></div></th></tr><tr><td class="navbox-abovebelow" colspan="2"><div>
<ul><li><a href="ANSI_C" title="ANSI C">ANSI C</a></li>
<li><a href="C99" title="C99">C99</a></li>
<li><a href="C11_(C_standard_revision)" title="C11 (C standard revision)">C11</a></li>
<li><a href="C17_(C_standard_revision)" title="C17 (C standard revision)">C17</a></li>
<li><a href="C23_(C_standard_revision)" title="C23 (C standard revision)">C23</a></li>
<li><a href="Embedded_C" title="Embedded C">Embedded C</a></li>
<li><a href="MISRA_C" title="MISRA C">MISRA C</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Features</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Subroutine" class="mw-redirect" title="Subroutine">Functions</a></li>
<li><a href="Include_directive#C" title="Include directive">Header files</a></li>
<li><a href="Operators_in_C_and_C%2B%2B" title="Operators in C and C++">Operators</a></li>
<li><a href="C_string_handling" title="C string handling">String</a></li>
<li><a href="C_syntax" title="C syntax">Syntax</a></li>
<li><a href="C_data_types" title="C data types">Data types</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="C_standard_library" title="C standard library">Standard library</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"></div><table class="nowraplinks navbox-subgroup" style="border-spacing:0"><tbody><tr><td colspan="2" class="navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="C_character_classification" title="C character classification">Char</a></li>
<li><a href="C_file_input/output" title="C file input/output">File I/O</a></li>
<li><a href="C_mathematical_functions" title="C mathematical functions">Math</a></li>
<li><a href="C_dynamic_memory_allocation" title="C dynamic memory allocation">Dynamic memory</a></li>
<li><a href="C_string_handling" title="C string handling">String</a></li>
<li><a href="C_date_and_time_functions" title="C date and time functions">Time</a></li>
<li><a href="Stdarg.h" title="Stdarg.h">Variadic</a></li>
<li><a href="C_POSIX_library" title="C POSIX library">POSIX</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Implementations</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Bionic_(software)" title="Bionic (software)">Bionic</a>
<ul><li><a href="Hybris_(software)" class="mw-redirect" title="Hybris (software)">libhybris</a></li></ul></li>
<li><a href="Dietlibc" title="Dietlibc">dietlibc</a></li>
<li><a href="Glibc" title="Glibc">glibc</a>
<ul><li><a href="Embedded_GLIBC" class="mw-redirect" title="Embedded GLIBC">EGLIBC</a></li></ul></li>
<li><a href="Klibc" title="Klibc">klibc</a></li>
<li><a href="Microsoft_Windows_library_files" title="Microsoft Windows library files">Windows CRT</a></li>
<li><a href="Musl" title="Musl">musl</a></li>
<li><a href="Newlib" title="Newlib">Newlib</a></li>
<li><a href="UClibc" title="UClibc">uClibc</a></li></ul>
</div></td></tr></tbody></table><div></div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="List_of_C_compilers" class="mw-redirect" title="List of C compilers">Compilers</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Amsterdam_Compiler_Kit" title="Amsterdam Compiler Kit">ACK</a></li>
<li><a href="Borland_Turbo_C" class="mw-redirect" title="Borland Turbo C">Borland Turbo C</a></li>
<li><a href="Clang" title="Clang">Clang</a></li>
<li><a href="GNU_Compiler_Collection" title="GNU Compiler Collection">GCC</a></li>
<li><a href="Intel_C%2B%2B_Compiler" title="Intel C++ Compiler">ICC</a></li>
<li><a href="LCC_(compiler)" title="LCC (compiler)">LCC</a></li>
<li><a href="Norcroft_C_compiler" title="Norcroft C compiler">Norcroft C</a></li>
<li><a href="Portable_C_Compiler" title="Portable C Compiler">PCC</a></li>
<li><a href="Small_Device_C_Compiler" title="Small Device C Compiler">SDCC</a></li>
<li><a href="Tiny_C_Compiler" title="Tiny C Compiler">TCC</a></li>
<li><a href="Microsoft_Visual_C%2B%2B" title="Microsoft Visual C++">Visual C++ (MSVC)</a></li>
<li><a href="Watcom_C/C%2B%2B" title="Watcom C/C++">Watcom C/C++</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Integrated_development_environment" title="Integrated development environment">IDEs</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Anjuta" title="Anjuta">Anjuta</a></li>
<li><a href="CLion" class="mw-redirect" title="CLion">CLion</a></li>
<li><a href="Code%3A%3ABlocks" title="Code::Blocks">Code::Blocks</a></li>
<li><a href="CodeLite" title="CodeLite">CodeLite</a></li>
<li><a href="Eclipse_(software)" title="Eclipse (software)">Eclipse</a></li>
<li><a href="Geany" title="Geany">Geany</a></li>
<li><a href="GNOME_Builder" title="GNOME Builder">GNOME Builder</a></li>
<li><a href="KDevelop" title="KDevelop">KDevelop</a></li>
<li><a href="NetBeans" title="NetBeans">NetBeans</a></li>
<li><a href="Visual_Studio" title="Visual Studio">Visual Studio</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Comparison with<br>other languages</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Compatibility_of_C_and_C%2B%2B" title="Compatibility of C and C++">Compatibility of C and C++</a></li>
<li><a href="Comparison_of_Pascal_and_C" title="Comparison of Pascal and C">Comparison with Pascal</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Descendant<br>languages</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Alef_(programming_language)" title="Alef (programming language)">Alef</a></li>
<li><a href="C%2B%2B" title="C++">C++</a></li>
<li><a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a></li>
<li><a href="D_(programming_language)" title="D (programming language)">D</a></li>
<li><a href="Objective-C" title="Objective-C">Objective-C</a></li>
<li><a href="Go_(programming_language)" title="Go (programming language)">Go</a></li>
<li><a href="Vala_(programming_language)" title="Vala (programming language)">Vala</a></li>
<li><a href="Zig_(programming_language)" title="Zig (programming language)">Zig</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Designer</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Dennis_Ritchie" title="Dennis Ritchie">Dennis Ritchie</a></li></ul>
</div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div>
<ul><li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> <b>Category</b></li></ul>
</div></td></tr></tbody></table></div>
<div class="navbox-styles"></div><div role="navigation" class="navbox" aria-labelledby="C++536" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><div id="C++536" style="font-size:114%;margin:0 4em"><a href="C%2B%2B" title="C++">C++</a></div></th></tr><tr><td class="navbox-abovebelow" colspan="2"><div>
<ul><li><a href="C%2B%2B" title="C++">C++</a></li>
<li><a href="Outline_of_C%2B%2B" title="Outline of C++">Outline</a></li>
<li><a href="C%2B%2B#Standardization" title="C++">C++98</a></li>
<li><a href="C%2B%2B03" title="C++03">C++03</a></li>
<li><a href="C%2B%2B11" title="C++11">C++11</a></li>
<li><a href="C%2B%2B14" title="C++14">C++14</a></li>
<li><a href="C%2B%2B17" title="C++17">C++17</a></li>
<li><a href="C%2B%2B20" title="C++20">C++20</a></li>
<li><a href="C%2B%2B23" title="C++23">C++23</a></li>
<li><a href="C%2B%2B26" title="C++26">C++26</a></li>
<li>Libraries</li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Features</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="C%2B%2B_syntax" title="C++ syntax">C++ syntax</a></li>
<li><a href="C%2B%2B_classes" title="C++ classes">Classes</a></li>
<li><a href="Concepts_(C%2B%2B)" title="Concepts (C++)">Concepts</a></li>
<li><a href="Copy_constructor_(C%2B%2B)" title="Copy constructor (C++)">Copy constructor</a></li>
<li><a href="C%2B%2B#Exception_handling" title="C++">Exception handling</a> (<a href="Exception_safety" title="Exception safety">Exception safety</a>)</li>
<li><a href="Function_overloading" title="Function overloading">Function overloading</a></li>
<li><a href="Modules_(C%2B%2B)" title="Modules (C++)">Modules</a></li>
<li><a href="C%2B%2B11#Rvalue_references_and_move_constructors" title="C++11">Move semantics</a></li>
<li><a href="New_and_delete_(C%2B%2B)" title="New and delete (C++)">new and delete</a></li>
<li><a href="Operator_overloading" title="Operator overloading">Operator overloading</a></li>
<li><a href="Operators_in_C_and_C%2B%2B" title="Operators in C and C++">Operators</a></li>
<li><a href="Reference_(C%2B%2B)" title="Reference (C++)">References</a></li>
<li><a href="Template_(C%2B%2B)" title="Template (C++)">Templates</a></li>
<li><a href="Virtual_function" title="Virtual function">Virtual functions</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="C%2B%2B_Standard_Library" title="C++ Standard Library">Standard Library</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Input/output_(C%2B%2B)" title="Input/output (C++)">I/O Streams</a></li>
<li><a href="Smart_pointer" title="Smart pointer">Smart pointers</a></li>
<li><a href="Standard_Template_Library" title="Standard Template Library">STL</a></li>
<li><a href="C%2B%2B_string_handling" title="C++ string handling">Strings</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Ideas</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="As-if_rule" title="As-if rule">As-if rule</a></li>
<li><a href="Barton%E2%80%93Nackman_trick" title="Barton–Nackman trick">Barton–Nackman trick</a></li>
<li><a href="Curiously_recurring_template_pattern" title="Curiously recurring template pattern">Curiously recurring template pattern</a></li>
<li><a href="Most_vexing_parse" title="Most vexing parse">Most vexing parse</a></li>
<li><a href="One_Definition_Rule" title="One Definition Rule">One Definition Rule</a></li>
<li><a href="Resource_acquisition_is_initialization" title="Resource acquisition is initialization">Resource acquisition is initialization</a></li>
<li><a href="Rule_of_three_(C%2B%2B_programming)" title="Rule of three (C++ programming)">Rule of three</a></li>
<li><a href="Object_slicing" title="Object slicing">Slicing</a></li>
<li><a href="Special_member_functions" title="Special member functions">Special member functions</a></li>
<li><a href="Substitution_failure_is_not_an_error" title="Substitution failure is not an error">Substitution failure is not an error</a></li>
<li><a href="Template_metaprogramming" title="Template metaprogramming">Template metaprogramming</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Compilers</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="List_of_compilers#C++_compilers" title="List of compilers">Comparison of C++ compilers</a></li>
<li><i><a href="Borland_C%2B%2B" title="Borland C++">Borland C++</a></i></li>
<li><i><a href="Borland_C%2B%2B" title="Borland C++">Borland Turbo C++</a></i></li>
<li><a href="C%2B%2BBuilder" title="C++Builder">C++Builder</a></li>
<li><a href="Clang" title="Clang">Clang</a></li>
<li><a href="GNU_Compiler_Collection" title="GNU Compiler Collection">GCC</a></li>
<li><a href="Intel_C%2B%2B_Compiler" title="Intel C++ Compiler">Intel C++ Compiler</a></li>
<li><a href="Oracle_Developer_Studio" title="Oracle Developer Studio">Oracle Solaris Studio</a></li>
<li><a href="Microsoft_Visual_C%2B%2B" title="Microsoft Visual C++">Visual C++ (MSVC)</a></li>
<li><a href="Watcom_C/C%2B%2B" title="Watcom C/C++">Watcom C/C++</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">IDEs</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Comparison_of_integrated_development_environments#C/C++" title="Comparison of integrated development environments">Comparison of C IDEs</a></li>
<li><i><a href="Anjuta" title="Anjuta">Anjuta</a></i></li>
<li><a href="CLion" class="mw-redirect" title="CLion">CLion</a></li>
<li><a href="Code%3A%3ABlocks" title="Code::Blocks">Code::Blocks</a></li>
<li><a href="CodeLite" title="CodeLite">CodeLite</a></li>
<li><a href="Dev-C%2B%2B" title="Dev-C++">Dev-C++</a></li>
<li><a href="Eclipse_(software)" title="Eclipse (software)">Eclipse</a></li>
<li><a href="Geany" title="Geany">Geany</a></li>
<li><a href="NetBeans" title="NetBeans">NetBeans</a></li>
<li><a href="KDevelop" title="KDevelop">KDevelop</a></li>
<li><a href="Qt_Creator" title="Qt Creator">Qt Creator</a></li>
<li><a href="Visual_Studio" title="Visual Studio">Visual Studio</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Superset languages</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Objective-C%2B%2B" class="mw-redirect" title="Objective-C++">Objective-C++</a></li>
<li><a href="C%2B%2B/CLI" title="C++/CLI">C++/CLI</a></li>
<li><a href="C%2B%2B/CX" title="C++/CX">C++/CX</a></li>
<li><a href="C%2B%2B/WinRT" title="C++/WinRT">C++/WinRT</a></li>
<li><a href="Ch_(computer_programming)" title="Ch (computer programming)">Ch</a></li>
<li><a href="SYCL" title="SYCL">SYCL</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Dialects</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Embedded_C%2B%2B" title="Embedded C++">Embedded C++</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Relative to<br>other languages</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Comparison_of_programming_languages" title="Comparison of programming languages">Comparison of programming languages</a></li>
<li><a href="Comparison_of_Java_and_C%2B%2B" title="Comparison of Java and C++">Comparison of Java and C++</a></li>
<li><a href="Compatibility_of_C_and_C%2B%2B" title="Compatibility of C and C++">Compatibility of C and C++</a></li>
<li><a href="Criticism_of_C%2B%2B" title="Criticism of C++">Criticism of C++</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">People</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="David_Abrahams_(computer_programmer)" title="David Abrahams (computer programmer)">David Abrahams</a></li>
<li><a href="Andrei_Alexandrescu" title="Andrei Alexandrescu">Andrei Alexandrescu</a></li>
<li><a href="Pete_Becker" title="Pete Becker">Pete Becker</a></li>
<li><a href="Rick_Mascitti" class="mw-redirect" title="Rick Mascitti">Rick Mascitti</a></li>
<li><a href="Scott_Meyers" title="Scott Meyers">Scott Meyers</a></li>
<li><a href="Alexander_Stepanov" title="Alexander Stepanov">Alexander Stepanov</a></li>
<li><a href="Bjarne_Stroustrup" title="Bjarne Stroustrup">Bjarne Stroustrup</a></li>
<li><a href="Herb_Sutter" title="Herb Sutter">Herb Sutter</a></li></ul>
</div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> <b>Category</b></div></td></tr></tbody></table></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-08-05" href="https://en.wikipedia.org/wiki/?title=C_preprocessor&oldid=1304369686">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>